<bit-toggle-group
  fullWidth
  class="tw-mb-4"
  [selected]="credentialType$ | async"
  (selectedChange)="onCredentialTypeChanged($event)"
  *ngIf="showCredentialTypes$ | async"
  attr.aria-label="{{ 'type' | i18n }}"
>
  <bit-toggle *ngFor="let option of passwordOptions$ | async" [value]="option.value">
    {{ option.label }}
  </bit-toggle>
</bit-toggle-group>
<bit-card class="tw-flex tw-justify-between tw-mb-4">
  <div class="tw-grow tw-flex tw-items-center tw-min-w-0">
    <bit-color-password class="tw-font-mono" [password]="value$ | async"></bit-color-password>
  </div>
  <div class="tw-flex tw-items-center tw-space-x-1">
    <button
      type="button"
      bitIconButton="bwi-generate"
      buttonType="main"
      (click)="generate(USER_REQUEST)"
      [appA11yTitle]="credentialTypeGenerateLabel$ | async"
      [disabled]="!(algorithm$ | async)"
    >
      {{ credentialTypeGenerateLabel$ | async }}
    </button>
    <button
      type="button"
      bitIconButton="bwi-clone"
      buttonType="main"
      showToast
      [appA11yTitle]="credentialTypeCopyLabel$ | async"
      [appCopyClick]="value$ | async"
      [valueLabel]="credentialTypeLabel$ | async"
      [disabled]="!(algorithm$ | async)"
    ></button>
  </div>
</bit-card>
<tools-password-settings
  class="tw-mt-6"
  *ngIf="(algorithm$ | async)?.id === Algorithm.password"
  [account]="account$ | async"
  [disableMargin]="disableMargin"
  (onUpdated)="generate('password settings')"
/>
<tools-passphrase-settings
  class="tw-mt-6"
  *ngIf="(algorithm$ | async)?.id === Algorithm.passphrase"
  [account]="account$ | async"
  (onUpdated)="generate('passphrase settings')"
  [disableMargin]="disableMargin"
/>
